import React from 'react';
import { Router, Route, Switch } from 'dva/router';
// import IndexPage from './routes/IndexPage';
import Wellcome from './components/Wellcome';
import LeftMenu from './components/LeftMenu';
import OrdersPage from './routes/OrdersPage';
import WarehousePage from './routes/WarehousePage';
import MaterialPage from './routes/MaterialPage';
import DefaultOrder from './routes/check/CustomersPage';
import Liabilities from './routes/check/SuppliersPage';
import CustomersPage from './routes/manage/CustomersPage';
import SuppliersPage from './routes/manage/SuppliersPage';
import GoodsPage from './routes/manage/GoodsPage';
import NotFound from './components/NotFound';

function RouterConfig({ history }) {
  return (
    <Router history={history}>
      <div style={{ display: 'flex' }}>
        <div style={{ width: 200 }}>
          <LeftMenu />
        </div>
        <div style={{ flex: 1 }}>
          <Switch>
            <Route path="/" exact component={Wellcome} />
            <Route path="/orders" component={OrdersPage} />
            <Route path="/warehouse" component={WarehousePage} />
            <Route path="/material" component={MaterialPage} />
            <Route path="/check/customers" component={DefaultOrder} />
            <Route path="/check/suppliers" component={Liabilities} />
            <Route path="/manage/customers" component={CustomersPage} />
            <Route path="/manage/suppliers" component={SuppliersPage} />
            <Route path="/manage/goods" component={GoodsPage} />
            <Route path="/" component={NotFound} />
          </Switch>
        </div>
      </div>
    </Router>
  );
}

export default RouterConfig;
